#ifndef _KERNEL_H
#define _KERNEL_H

#include <exports.h>
#include <bits/errno.h>
#include <bits/swi.h>

#define LDR_INSTR 0xE59FF000
#define LDR_OPCODE(instr) ((instr) & 0xFFFFF000)
#define LDR_OFFSET(instr) ((instr) & 0xFFF)
#define LDR_POS_OFFSET(instr) ((instr) & 0x800000)
#define BAD_CODE 0x0BADC0DE

#define SWI_VECTOR (0x8)
#define IRQ_VECTOR (0x18)

#define STDIN 0
#define STDOUT 1
#define START_SDRAM 0xa0000000
#define END_SDRAM 0xa3ffffff
#define START_SFROM 0x0
#define END_SFROM 0xffffff
#define EOT 4
#define BACKSPACE 8
#define DELETE 127
#define NEWLINE 10
#define CARRIAGE_RETURN 13

#define USER_STACK_BASE (0xA3000000)
#define IRQ_STACK_SIZE 1024
#define TIMER_RES (10/1000) //10 ms


int setup_irq(unsigned int * uboot_i);
void irq_wrapper();
extern unsigned int uboot_irq[3];
extern unsigned int icmr, iclr, osmr0, osmr1, osmr2, osmr3, oscr, oier;

#endif
